'use strict';
const { apiUrl } = require('./constants.js')

async function http(apiUrl, parseUrl) {
	const res = uniCloud.httpclient.request(apiUrl, {
		method: 'GET',
		data: {
			url: parseUrl
		},
		dataType: 'json',
		timeout: 3000
	})
	return res
}

exports.main = async (event, context) => {

	const { parseUrl } = event.queryStringParameters
	const res = await http(apiUrl, parseUrl)
	return res.data
};